﻿using Framework;
using UnityEngine.InputSystem;

namespace Game
{
    public class TouchComponent : ReferenceCountable, IComponent
    {
        public virtual void Dispose()
        {
        }

        public void OnTouch(GameTouch touch)
        {
            switch (touch.touchPhase)
            {
                case TouchPhase.Began:
                    OnTouchBegan(touch);
                    break;
                case TouchPhase.Moved:
                    OnTouchMoved(touch);
                    break;
                case TouchPhase.Stationary:
                    OnTouchStationary(touch);
                    break;
                case TouchPhase.Ended:
                    OnTouchEnded(touch);
                    break;
            }
        }
        
        protected virtual void OnTouchBegan(GameTouch touch)
        {
        }
        
        protected virtual void OnTouchMoved(GameTouch touch)
        {
        }
        
        protected virtual void OnTouchStationary(GameTouch touch)
        {
        }
        
        protected virtual void OnTouchEnded(GameTouch touch)
        {
        }
    }
}